import java.util.*;

public class CollectionUtils {
    public static <T> void visit(Collection<T> collection) {
        Iterator<T> iterator = collection.iterator();
        while (iterator.hasNext()) {
            T element = iterator.next();
            System.out.println(element);
        }
    }

    public static void main(String[] args) {
        List<String> list = new ArrayList<>();
        list.add("软件2201");
        list.add("蒋林康");
        CollectionUtils.visit(list);

        Set<Integer> set = new HashSet<>();
        set.add(999);
        set.add(444);
        CollectionUtils.visit(set);
    }
    }
